<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <base th:href="@{/}" href="/bookstore/"/>
    <link rel="stylesheet" href="static/css/minireset.css" />
    <link rel="stylesheet" href="static/css/common.css" />
    <link rel="stylesheet" href="static/css/style.css" />
    <link rel="stylesheet" href="static/css/cart.css" />
    <link rel="stylesheet" href="static/css/bookManger.css" />
    <link rel="stylesheet" href="static/css/register.css" />
    <link rel="stylesheet" href="static/css/book_edit.css" />
  </head>
  <body>
    <div class="header">
      <div class="w">
        <div class="header-left">
          <a href="index.html">
            <img src="static/img/logo.gif" alt=""/></a>
          <h1>编辑图书</h1>
        </div>
        <div class="header-right">
          <a href="bookManager?method=toBookManagerPage">图书管理</a>
          <a href="protected/orderClient?method=toManagerOrderPage" class="destory">订单管理</a>
          <a href="index.html" class="gohome">返回商城</a>
        </div>
      </div>
    </div>
    <div class="login_banner" style="height: 550px !important;">
      <div class="register_form" style="height: 530px !important;">
        <!--修改图书的表单-->
        <form action="bookManager?method=saveOrUpdateBook" method="post" th:if="${book != null}">
          <div class="form-item">
            <!--使用隐藏域绑定bookId-->
            <input type="hidden" name="bookId" th:value="${book.bookId}"/> <div>
            <label>名称:</label>
            <input type="text" th:value="${book.bookName}" placeholder="请输入名称" name="bookName" />
          </div>
            <span class="errMess" style="visibility: hidden;">请输入正确的名称</span >
          </div>
          <div class="form-item">
            <div>
              <label>类别:</label>
              <input type="text" th:value="${book.typeName}" placeholder="请输入类别" name="typeName" />
            </div>
            <span class="errMess">请输入正确的类别</span> </div>
          <div class="form-item">
            <div>
              <label>价格:</label>
              <input type="number" th:value="${book.price}" placeholder="请输入价格" name="price" />
            </div>
            <span class="errMess">请输入正确数字</span> </div>
          <div class="form-item">
            <div>
              <label>作者:</label>
              <input type="text" th:value="${book.author}" placeholder="请输入作者" name="author"/>
            </div>
            <span class="errMess">请输入正确作者</span>
          </div>
          <div class="form-item">
            <div>
              <label>销量:</label>
              <input type="number" th:value="${book.sales}" placeholder="请输入销量" name="sales" />
            </div>
            <span class="errMess">请输入正确销量</span> </div>
          <div class="form-item">
            <div>
              <label>库存:</label>
              <input type="number" th:value="${book.stock}" placeholder="请输入库存" name="stock"/>
            </div>
            <span class="errMess">请输入正确库存</span> </div>
          <button type="submit" class="btn">提交</button> </form>
        <!--这是添加图书的表单-->
        <form action="bookManager?method=saveOrUpdateBook" method="post" th:unless="${book != null}">
          <div class="form-item">
            <div>
              <label>名称:</label>
              <input type="text" placeholder="请输入名称" name="bookName" /> </div>
            <span class="errMess" style="visibility: hidden;">请输入正确的名称</span >
          </div>
          <div class="form-item">
            <div>
              <label>类别:</label>
              <input type="text" placeholder="请输入类别" name="typeName" />
            </div>
            <span class="errMess">请输入正确的类别</span>
          </div>
          <div class="form-item">
            <div>
              <label>价格:</label>
              <input type="number" placeholder="请输入价格" name="price" />
            </div>
            <span class="errMess">请输入正确数字</span> </div>
          <div class="form-item">
            <div>
              <label>作者:</label>
              <input type="text" placeholder="请输入作者" name="author"/> </div>
            <span class="errMess">请输入正确作者</span> </div>
          <div class="form-item">
            <div>
              <label>销量:</label>
              <input type="number" placeholder="请输入销量" name="sales" /> </div>
            <span class="errMess">请输入正确销量</span> </div>
          <div class="form-item">
            <div>
              <label>库存:</label>
              <input type="number" placeholder="请输入库存" name="stock"/> </div>
            <span class="errMess">请输入正确库存</span> </div>
          <button type="submit" class="btn">提交</button>
        </form>

      </div>
    </div>
    <div class="bottom">
      Drimwai's Bookstore.Copyright ©2021
    </div>
  </body>
</html>
